//
//  HJUserInfo.m
//  KaiChat
//
//  Created by lx on 2023/10/16.
//

#import "HJUserInfo.h"

#define UserDefaults [NSUserDefaults standardUserDefaults]

@implementation HJUserInfo

+ (void)setToken:(NSString *)token {
    [UserDefaults setValue:token forKey:user_token];
}

+ (NSString *)token {
    return [UserDefaults valueForKey:user_token];
}

+ (void)setUserId:(NSString *)userId {
    [UserDefaults setValue:userId forKey:user_Id];
}

+ (NSString *)userId {
    return [UserDefaults valueForKey:user_Id];
}

+ (void)setNo:(NSString *)no {
    [UserDefaults setValue:no forKey:user_no];
}

+ (NSString *)no {
    return [UserDefaults valueForKey:user_no];
}

+ (void)setIsLogin:(BOOL)isLogin {
    [UserDefaults setValue:@(isLogin) forKey:user_isLogin];
}

+ (BOOL)isLogin {
    return [[UserDefaults valueForKey:user_isLogin] boolValue];
}


+ (void)setEmail:(NSString *)email {
    if (![email isKindOfClass:NSString.class]) return;
    [UserDefaults setValue:email forKey:user_email];
}

+ (NSString *)email {
    return [UserDefaults valueForKey:user_email];
}

+ (void)setAvatar:(NSString *)avatar {
    [UserDefaults setValue:avatar forKey:user_avatar];
}

+ (NSString *)avatar {
    return [UserDefaults valueForKey:user_avatar];
}

+ (void)setAgreement:(NSString *)agreement {
    [UserDefaults setValue:agreement forKey:user_agreement];
}

+ (NSString *)agreement {
    return [UserDefaults valueForKey:user_agreement];
}

+ (void)setNickname:(NSString *)nickname {
    [UserDefaults setValue:nickname forKey:user_nickname];
}

+ (NSString *)nickname {
    return [UserDefaults valueForKey:user_nickname];
}

+ (void)setGender:(NSString *)gender {
    [UserDefaults setValue:gender forKey:user_gender];
}

+ (NSString *)gender {
    return [UserDefaults valueForKey:user_gender];
}

+ (void)setIsCanModify:(BOOL)isCanModify {
    [UserDefaults setValue:@(isCanModify) forKey:user_isCanModify];
}

+ (BOOL)isCanModify {
    return [[UserDefaults valueForKey:user_isCanModify] boolValue];
}

+ (void)clear {
    [UserDefaults removeObjectForKey:user_isLogin];
    [UserDefaults removeObjectForKey:user_token];
    [UserDefaults removeObjectForKey:user_nickname];
    [UserDefaults removeObjectForKey:user_gender];
    [UserDefaults removeObjectForKey:user_isCanModify];
    [UserDefaults removeObjectForKey:user_avatar];
    [UserDefaults removeObjectForKey:user_Id];
}



@end
